473,425 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Compress a string

I have a long string, actually a MAPI entry ID that I want to compress down
for storing into a database. An example is:
"0000000020CCCFAC05C0B14B920BE916F0ADEC54070012EA1 E9997A09B4391EA8D617B81A95
3000000004E46000012EA1E9997A09B4391EA8D617B81A9530 00000005D820000"

Anybody have any ides On how this could be performed. It's not mission
critical so we would prefer not to buy 3rd party tools.

Cheers,
Nov 15 '05 #1
2 5333
Darren,

The best way I could think of to do this would be to actually represent
the number in a byte array. Since the number is a hexidecimal value, the
first four zeros could be stored as one byte. Do this to the whole string,
and you would need only 35 bytes instead of the 140 you would need to store
the string itself.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ca*******@caspershouse.com

"Darren B" <da******@fwbs.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have a long string, actually a MAPI entry ID that I want to compress down for storing into a database. An example is:
"0000000020CCCFAC05C0B14B920BE916F0ADEC54070012EA1 E9997A09B4391EA8D617B81A95 3000000004E46000012EA1E9997A09B4391EA8D617B81A9530 00000005D820000"

Anybody have any ides On how this could be performed. It's not mission
critical so we would prefer not to buy 3rd party tools.

Cheers,

Nov 15 '05 #2
Darren,

I made a little mistake, every two characters is one byte, not every
four characters. This would still cut the length in half.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Darren B" <da******@fwbs.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have a long string, actually a MAPI entry ID that I want to compress down for storing into a database. An example is:
"0000000020CCCFAC05C0B14B920BE916F0ADEC54070012EA1 E9997A09B4391EA8D617B81A95 3000000004E46000012EA1E9997A09B4391EA8D617B81A9530 00000005D820000"

Anybody have any ides On how this could be performed. It's not mission
critical so we would prefer not to buy 3rd party tools.

Cheers,

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: José Carlos | last post by:
Hi. How i could compress string of data?. I heart that it´s possible to make with librep, but i´dont know the way to do it. if somebody know any way to do it or any web where explain it i...
0
by: Patrick Questembert | last post by:
I am developping with Visual Studio 2003 + C# + MySQL 4.1 and the OleDb components. My problem is that a stament using the COMPRESS() function seems to work or not depending on the data ... Here...
3
by: Edward | last post by:
Thanks to Bob Powel (http://www.bobpowell.net/onebit.htm) I'm able to compress an image. However, this method takes a long time to compress an image. Does anyone know a quicker way? (The images I...
3
by: delphiconsultingguy | last post by:
Anybody? thanks, Sean
14
by: Hugh Janus | last post by:
Hi all, I have several *long* strings (see bottom of post for an example) which I will be sending across a network. Therefore, I want to compress them for speed and because later they will be...
6
by: Champika Nirosh | last post by:
Hi, I have two machine where I needed to have a extended TCP/IP protocol to make the link between the two machines Mean,I need to write a application that compress every data the machine send...
6
by: Adriano | last post by:
Can anyone recommend a simple way to compress/decomress a String in .NET 1.1 ? I have a random string of 70 characters, the output from a DES3 encryption, and I wish to reduce the lengh of it, ...
0
by: vampire1986 | last post by:
Hi all. I have project compress file using C#. I'm using name space IO.Compression and i saw this code on Internet but it is compress to file bigger than source file. Can you help me, please.Thanks...
0
by: J. Clifford Dyer | last post by:
On Sun, May 18, 2008 at 07:06:10PM +0100, Matt Porter wrote regarding Compress a string: def compress_str(s): # str is a builtin keyword. Don't overload it. out = for c in s: if out and c ==...
0
by: Matt Porter | last post by:
On Sun, 18 May 2008 19:13:57 +0100, J. Clifford Dyer <jcd@sdf.lonestar.orgwrote: Thanks. Had to change a few bits to make it behave as I expected: def compress_str(s): # str is a builtin...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.